<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script crossorigin="anonymous" integrity="sha384-6ePHh72Rl3hKio4HiJ841psfsRJveeS+aLoaEf3BWfS+gTF0XdAqku2ka8VddikM"
        src="https://lib.baomitu.com/jquery/1.11.3/jquery.min.js"></script>
    <title>算法举例-100</title>
</head>

<body>
    <script>
        $(function () {
            let sum = 0;

            // 由小到大输出3个数
            sort5()

            // 一年中的第几天
            // rankingDay4()

            // 一个整数
            // int3()

            //依据利润计算提成
            // bonus2()

            // 输出不重复的数字
            // number1();



            function sort5(){
                let x=[]
                x[0]=prompt("请输入第1/3个数",12)
                x[1]=prompt("请输入第2/3个数",3)
                x[2]=prompt("请输入第3/3个数",6)
                console.log(change(x))
            }
            function change(x){
                if(x[0]>x[1]){
                    let tmp=''
                    tmp=x[0]
                    x[0]=x[1]
                    x[1]=tmp
                }
                return x
            }
            function rankingDay4(){
                let year=prompt("请输入年份",2019)
                let month=prompt("请输入月份",1)
                let day=parseInt(prompt("请输入日",5))
                // let sum=0
                let days=[0,31,28,31,30,31,30,31,31,30,31,30,31]
                    //      1  2  3  4  5  6  7  8  9  10 11 12
                if(year%400==0||(year%4==0&&year%100!=0)){
                    days[2]=29
                }
                // sum+=day
                for(let i=1;i<month;i++){
                    day+=days[i]
                }
                console.log(year,"年",month,"月",day,"日，是一年中的第",day,"天")

            }
            function int3() {
                for (let x = 1; x <100000; x++) {
                    a=parseInt(Math.sqrt(x + 100))
                    b=parseInt(Math.sqrt(x + 268))

                    if ( Math.pow(a,2)==x+100 && Math.pow(b,2)==x+268) {
                        console.log(x)
                    }
                }
            }
            function bonus2() {
                console.log("In bonus");
                let x = prompt("请输入利润/万元", 120)
                let bonus = 0;
                bonus1 = 10 * 0.1;
                bonus2 = (20 - 10) * 0.075;
                bonus4 = (40 - 20) * 0.05;
                bonus6 = (60 - 40) * 0.03;
                bonus10 = (100 - 60) * 0.015;

                if (x <= 10) {
                    bonus = x * 0.1
                } else if (10 < x <= 20) {
                    bonus = (x - 10) * 0.075 + bonus1
                } else if (20 < x <= 40) {
                    bonus = (x - 20) * 0.05 + bonus1 + bonus2
                } else if (40 < x <= 60) {
                    bonus = (x - 40) * 0.03 + bonus1 + bonus2 + bonus4
                } else if (60 < x <= 100) {
                    bonus = (x - 60) * 0.015 + bonus1 + bonus2 + bonus4 + bonus6
                } else if (x > 100) {
                    bonus = (x - 100) * 0.01 + bonus1 + bonus2 + bonus4 + bonus6 + bonus10
                }
                console.log("奖金为:", bonus)
            }
            function number1() {
                for (let i = 1; i < 5; i++) {
                    for (let j = 1; j < 5; j++) {
                        for (let k = 1; k < 5; k++) {
                            if (i != k && i != j && j != k) {
                                console.log("", i * 100 + j * 10 + k)
                                sum++;
                            }
                        }
                    }
                }
                console.log("共有", sum, "个数字")
            }

        });
    </script>
</body>

</html>